version: "3"

services:
{% if 'mq_namesrv' in group_names %}
  namesrv:
    image: "{{ rocketmq.docker_image }}"
    container_name: rocketmq-namesrv
    restart: always
    network_mode: host
    volumes:
      - "/etc/localtime:/etc/localtime"
      - "{{ rocketmq.workdir }}/rocketmq-all-{{ rocketmq.version }}-bin-release:/opt/rocketmq"
    working_dir: /opt/rocketmq/bin
    command: "sh mqnamesrv"
{% endif %}

{% if 'mq_broker' in group_names %}
  broker:
    image: "{{ rocketmq.docker_image }}"
    container_name: rocketmq-broker
    restart: always
    network_mode: host
    volumes:
      - "/etc/localtime:/etc/localtime"
      - "{{ rocketmq.workdir }}/rocketmq-all-{{ rocketmq.version }}-bin-release:/opt/rocketmq"
    working_dir: /opt/rocketmq/bin
    command: "sh mqbroker -n namesrv:9876"
{% endif %}